package com.pony.iphone.vo;

import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

/**
 * 问题答案VO
 * 用于返回给前端的最终答案数据
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class QuestionAnswerVO {
    // 问题ID
    private Long questionId;
    // 问题内容
    private String question;
    // 最终选择的答案（单个字符串）
    private String selectedAnswer;
    // 答案来源：stable-稳定版本 random-随机选择
    private String answerSource;
    // 稳定版本号（如果不是稳定版本，返回0）
    private Long version;

    /**
     * 构造方法 - 用于稳定版本
     * @param questionId 问题ID
     * @param question 问题内容
     * @param stableAnswer 稳定版本答案
     * @param version 稳定版本号
     */
    public QuestionAnswerVO(Long questionId, String question, String stableAnswer, Long version) {
        this.questionId = questionId;
        this.question = question;
        this.selectedAnswer = stableAnswer;
        this.answerSource = "stable";
        this.version = version;
    }

    /**
     * 构造方法 - 用于随机版本
     * @param questionId 问题ID
     * @param question 问题内容
     * @param randomAnswer 随机答案
     */
    public QuestionAnswerVO(Long questionId, String question, String randomAnswer) {
        this.questionId = questionId;
        this.question = question;
        this.selectedAnswer = randomAnswer;
        this.answerSource = "random";
        this.version = 0L;
    }
}